<?php ob_start(); ?> 
<?php header ('Content-type: text/xml; charset=utf-8'); ?>     

<?php include "constants.inc" ?>

<?php include "classes.inc" ?>

<?php session_start(); ?>

<?php

function storeResult() {

	if (isset($_GET['result']) && isset($_GET['boardNr'])) {

		$matchResult = $_GET['result'];

		$boardNr = $_GET['boardNr'];

		

		$connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);

		mysql_select_db(DB_CATALOG);

		

		/*$result = mysql_query("select result from zt_result_type 

			where result_type_id = ".$resultId);

        $record = mysql_fetch_assoc($result);

        $result = $record['result'];*/

        

        $homeTeamBP = 0.0;

      	$visitTeamBP = 0.0;

		

		if (strnatcasecmp("1 - 0", $matchResult) == 0) {

          $homeTeamBP += 1.0;

        } else if (strnatcasecmp("5 - 5", $matchResult) == 0) {

          $homeTeamBP += 0.5;

          $visitTeamBP += 0.5;

        } else if (strnatcasecmp("0 - 1", $matchResult) == 0) {

          $visitTeamBP += 1.0;

        } else if (strnatcasecmp("1 - FF", $matchResult) == 0) {

          $homeTeamBP += 1.0;

        } else if (strnatcasecmp("FF - 1", $matchResult) == 0) {

          $visitTeamBP += 1.0;

        }

		

    	if (isset($_SESSION['homeTeamBP'])) {

    		$homeTeamBP += $_SESSION['homeTeamBP']; 

    	}

    	$_SESSION['homeTeamBP'] = $homeTeamBP;

    	

    	if (isset($_SESSION['visitTeamBP'])) {

    		$visitTeamBP += $_SESSION['visitTeamBP']; 

    	}

    	$_SESSION['visitTeamBP'] = $visitTeamBP;

        

    	return $_SESSION['homeTeamBP']."-".$_SESSION['visitTeamBP'];

  	}

  	return '0';

}

?>

<response>

  <method>storeResult</method>

  <result><?php echo storeResult()?></result>

</response>